package com.cyh.nio;

import java.io.BufferedReader;
import java.io.FileReader;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

/**
 * path使用
 * */
public class PathDemo01 {

    public static void main(String[] args) throws Exception {


        String filePath = "D:\\cyh\\work_java\\TestNioOrIo\\src\\com\\cyh\\5.txt";
        Path path = Paths.get(filePath);//文件
        String dir2 = "D:\\cyh\\work_java\\TestNioOrIo\\src\\com";
        String dir3 = "cyh";
        Path dirPath = Paths.get(dir2, dir3);//目录

        String dir4 = "D:\\cyh\\work_java\\TestNioOrIo\\src\\com";
        String filePath5 = "cyh\\5.txt";
        Path path6 = Paths.get(dir4, filePath5);//文件

        Path path7 = path6.normalize(); //路径标准化

        String filePath8 = "D:\\cyh\\work_java\\TestNioOrIo\\src\\com\\cyh\\files";
        Path path9 = Paths.get(filePath8);
        Path newDir = Files.createDirectory(path9); //会创建一个目录。





    }
}
